using System.Collections.Generic;
using System.Drawing;
using Microsoft.WowAddonStudio.FrameXml.Components.Support;
using Microsoft.WowAddonStudio.FrameXml.Serialization;
using Action=Microsoft.WowAddonStudio.FrameXml.Components.Actions.Action;

namespace Microsoft.WowAddonStudio.FrameXml.Components
{
    public interface IFrameXmlControl : IFrameXmlComponent
    {
        /// <summary>
        /// Gets the location of the FrameXML control.
        /// </summary>
        Point Location { get;  }

        /// <summary>
        /// Gets the size of the FrameXML control.
        /// </summary>
        Size Size { get; }

        /// <summary>
        /// Gets or sets the parent FrameXML control.
        /// </summary>
        new IFrameXmlControl Parent { get; set; }

        /// <summary>
        /// Gets the child controls from the child hierarchy of the FrameXML control.
        /// </summary>
        /// <typeparam name="TControl">The type of controls to get.</typeparam>
        /// <returns>An enumerable collection of <typeparamref name="TControl"/> instances.</returns>
        IEnumerable<TControl> GetChildControls<TControl>() where TControl : IFrameXmlControl;

        /// <summary>
        /// Converts the location of the specified client point to screen coordinates.
        /// </summary>
        /// <param name="point">The point to convert.</param>
        /// <returns>A <see cref="Point"/> structure.</returns>
        Point PointToScreen(Point point);

        /// <summary>
        /// Converts the location of the specified screen point to client coordinates.
        /// </summary>
        /// <param name="point">The point to convert.</param>
        /// <returns>A <see cref="Point"/> structure.</returns>
        Point PointToClient(Point point);

        /// <summary>
        /// Gets a frame point of the layout frame.
        /// </summary>
        /// <param name="framePoint">The frame point.</param>
        /// <returns>A <see cref="Point"/>structure holding the coordinates of the frame point.</returns>
        Point GetFramePoint(FramePoint framePoint);

        /// <summary>
        /// Gets an anchor point of the control.
        /// </summary>
        /// <param name="anchor">The anchor.</param>
        /// <param name="ignoreOffset">True, if the offset should be ignored.</param>
        /// <returns>A <see cref="Point"/> structure holding the coordinates of the anchor point.</returns>
        /// <remarks>
        /// The <see cref="Anchor.RelativePoint"/> <see cref="FramePoint"/> is used if it is specified. The returned point
        /// is in the parent's client coordinates.
        /// </remarks>
        Point GetAnchorPoint(Anchor anchor, bool ignoreOffset);

        /// <summary>
        /// Gets an anchor point of the control.
        /// </summary>
        /// <param name="anchor">The anchor.</param>
        /// <returns>A <see cref="Point"/> structure holding the coordinates of the anchor point.</returns>
        /// <remarks>
        /// The <see cref="Anchor.RelativePoint"/> <see cref="FramePoint"/> is used if it is specified. The returned point
        /// is in the parent's client coordinates.
        /// </remarks>
        Point GetAnchorPoint(Anchor anchor);

        /// <summary>
        /// Draws the FrameXML control.
        /// </summary>
        /// <param name="graphics">The <see cref="FrameXmlGraphics"/> context to draw to.</param>
        /// <param name="rectangle">The <see cref="Rectangle"/> to draw to.</param>
        /// <returns>True, if the control could be drawn; false otherwise.</returns>
        bool DrawControl(FrameXmlGraphics graphics, Rectangle rectangle);

        /// <summary>
        /// Draws a placeholder in place of the FrameXML control.
        /// </summary>
        /// <param name="graphics">The <see cref="FrameXmlGraphics"/> context to draw to.</param>
        /// <param name="rectangle">The <see cref="Rectangle"/> to draw to.</param>
        void DrawPlaceholder(FrameXmlGraphics graphics, Rectangle rectangle);

		/// <summary>
		/// Gets a value indicating whether this instance is inherited.
		/// </summary>
		/// <value>
		/// 	<c>true</c> if this instance is inherited; otherwise, <c>false</c>.
		/// </value>
		bool IsInherited { get; }

		/// <summary>
		/// Gets a value indicating whether the control has actions.
		/// </summary>
		bool HasActions { get; }

        /// <summary>
        /// Gets a value indicating whether this instance has parent.
        /// </summary>
        /// <value>
        /// 	<c>true</c> if this instance has parent; otherwise, <c>false</c>.
        /// </value>
        bool HasParent { get; }

        /// <summary>
        /// Gets the actions for the control.
        /// </summary>
        /// <returns>An array of <see cref="Actions.Action"/> instances.</returns>
        Action[] GetActions();
    }
}
